<?php

namespace app\common\model;

use think\Model;

class Wqdocument extends Model
{
    
    
    // 自动写入时间戳字段
    protected $autoWriteTimestamp = 'int';
    
    // 定义时间戳字段名
    protected $createTime = 'createtime';
    protected $updateTime = 'updatetime';
    
    // 追加属性
    protected $append = [
        'status_text',
    ];
    
    public function getStatusList()
    {
        return ['normal' => __('Normal'), 'hidden' => __('Hidden')];
    }
    
    
    public function getStatusTextAttr($value, $data)
    {
        $value = $value ? $value : $data['status'];
        $list = $this->getStatusList();
        return isset($list[$value]) ? $list[$value] : '';
    }
    /**
     * 读取分类类型
     * @return array
     */
    public static function getTypeList()
    {
        $typeList = [
            'week' => __('闻钱周报'),
            'days' => __('会员日'),
            'fa' => __('闻钱收藏夹'),
        ];
        return $typeList;
    }

    public function getTypeTextAttr($value, $data)
    {
        $value = $value ? $value : $data['type'];
        $list = $this->getTypeList();
        return $list[$value] ?? '';
    }
    
    
 
}